import { HttpClient, HttpErrorResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import {catchError} from 'rxjs/operators';
import { ApiService } from './api.service';
@Injectable({
  providedIn: 'root'
})
export class HttpService extends ApiService {
  //https://jsonplaceholder.typicode.com/todos/1

  constructor(private http: HttpClient) {
    super();
   }

  getTodos(todoId: number) {
 
    return this.http.get(`https://jsonplaceholder.typicode.com/todos/${todoId}`, {
      params: {
        id: 2,
        blah: 'dfdfd'
      }
    });
  }

  registerUser(resistrationData: any) {
    return this.http.post('https://jsonplaceholder.typicode.com/test',{
      ...resistrationData
    }).pipe(catchError(this.handleError));
  }


}
